<script setup lang="ts">
	import { ref } from "vue";
	import { formRules } from "./utils/rule";
	import { FormProps } from "./utils/types";
	import ReCol from "@/components/ReCol";
	const props = withDefaults(defineProps<FormProps>(), {
		formInline: () => ({
			title: "",
			status: 0,
			Id: 0,
		})
	});
	const ruleFormRef = ref();
	const newFormInline = ref(props.formInline);

	function getRef() {
		return ruleFormRef.value;
	}
	defineExpose({ getRef });
	const taskOptions = ref([
		{
			id: 1,
			name: '入库'
		},
		{
			id: 2,
			name: '出库'
		},
	])
	const taskStatusOptions = ref([
		{
			id:1,
			name: '执行'
		},
		{
			id:2,
			name: '中断'
		}
	])
</script>

<template>
	<el-form ref="ruleFormRef" :model="newFormInline" :rules="formRules" label-width="auto">
		<el-row :gutter="30">
			<re-col :value="12" :xs="24" :sm="24">				<el-form-item label="任务号" prop="name">					<el-input v-model="newFormInline.name" clearable placeholder="请输入任务号" />				</el-form-item>			</re-col>			<re-col :value="12" :xs="24" :sm="24">				<el-form-item label="托盘码" prop="code">					<el-input v-model="newFormInline.code" clearable placeholder="请输入托盘码" />				</el-form-item>			</re-col>			<re-col :value="12" :xs="24" :sm="24">				<el-form-item label="类型" prop="carStartXPos">
					<el-select
					    v-model="newFormInline.carStartXPos"
					    placeholder="请选择类型"
					  >
					    <el-option
					      v-for="item in taskOptions"
					      :key="item.id"
					      :label="item.name"
					      :value="item.id"
					    />
					  </el-select>				</el-form-item>			</re-col>			<re-col :value="12" :xs="24" :sm="24">				<el-form-item label="取货" prop="carEndXPos">
					<el-input v-model="newFormInline.carEndXPos" :min="0"  style="width: 100%;"/>				</el-form-item>			</re-col>
			<re-col :value="12" :xs="24" :sm="24">
				<el-form-item label="放货" prop="carStartYPos">
					<el-input v-model="newFormInline.carStartYPos" :min="0"  style="width: 100%;"/>
				</el-form-item>
			</re-col>
			<re-col :value="12" :xs="24" :sm="24">
				<el-form-item label="接单时间" prop="carEndYPos">
					<el-date-picker
						v-model="newFormInline.carEndYPos"
						type="datetime"
						placeholder="请选择接单时间"
						format="YYYY-MM-DD HH:mm:ss"
						value-format="YYYY-MM-DD HH:mm:ss"
						style="width: 100%;"
					  />
				</el-form-item>
			</re-col>
			<re-col :value="12" :xs="24" :sm="24">
				<el-form-item label="任务状态" prop="carXIncrRight">
					<el-select
					    v-model="newFormInline.carXIncrRight"
					    placeholder="请选择任务状态"
					  >
					    <el-option
					      v-for="item in taskStatusOptions"
					      :key="item.id"
					      :label="item.name"
					      :value="item.id"
					    />
					  </el-select>
				</el-form-item>
			</re-col>
			
		</el-row>
	</el-form>
</template>
<style scoped>
	.avatar-uploader .el-upload {
		border: 1px dashed var(--el-border-color);
		border-radius: 6px;
		cursor: pointer;
		position: relative;
		overflow: hidden;
		transition: var(--el-transition-duration-fast);
	}

	.avatar-uploader .el-upload:hover {
		border-color: var(--el-color-primary);
	}

	.el-icon.avatar-uploader-icon {
		font-size: 28px;
		color: #8c939d;
		width: 178px;
		height: 178px;
		text-align: center;
	}
</style>